/**
 * $Id: StringUtil.java 2 2011-09-03 10:16:43Z adriftrock@gmail.com $
 */

package com.swehr.common;

/**
 * @author Rock Huang
 * @version 0.1
 */
public class StringUtil {

    private StringUtil() {}

    public static boolean isEmptyOrNull(String s) {
        return s == null || s.isEmpty();
    }

    public static String trim(String s) {
        int p = s.indexOf("^");
        if (p != -1) {
            return s.substring(0, s.indexOf("^"));
        }
        return s;
    }

    public static void replace(StringBuffer src, String str, String newStr) {
        int pos = src.indexOf(str);
        src.replace(pos, pos + str.length(), newStr);
    }

}
